package com.cleaningcloud.cld.api;


import com.cleaningcloud.cld.api.domain.CldRecruitPlan;
import com.cleaningcloud.cld.api.domain.CldStaff;
import com.cleaningcloud.cld.api.factory.RemoteStaffFallbackFactory;
import com.cleaningcloud.cld.api.model.LoginStaff;
import com.cleaningcloud.common.core.constant.SecurityConstants;
import com.cleaningcloud.common.core.constant.ServiceNameConstants;
import com.cleaningcloud.common.core.domain.R;
import com.cleaningcloud.common.core.web.domain.AjaxResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 员工服务
 *
 * @author
 */
@FeignClient(contextId = "remoteStaffService", value = ServiceNameConstants.CLD_SERVICE, fallbackFactory = RemoteStaffFallbackFactory.class)
public interface RemoteStaffService {

    /**
     * 通过手机号查询员工信息
     *
     * @param staffPhone 手机号码
     * @return 结果
     */
    @GetMapping("/mini/basicInfo/staff/info/{staffPhone}")
    R<LoginStaff> getStaffInfo(@PathVariable("staffPhone") String staffPhone, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


    /**
     * 通过手机号查询项目客户信息
     *
     * @param accountPhone 手机号码
     * @return 结果
     */
    @GetMapping("/mini/basicInfo/projectAccount/info/{accountPhone}")
    R<LoginStaff> getProjectAccountInfo(@PathVariable("accountPhone") String accountPhone, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


    /**
     * 注册员工信息
     *
     * @param staff 员工信息
     * @return 结果
     */
    @PostMapping("/mini/basicInfo/staff/register")
    R<Boolean> registerStaffInfo(@RequestBody CldStaff staff, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


    /**
     * 招聘计划查询
     *
     * @return 结果
     */
    @RequestMapping("/recruitPlan/getInfoByRecruitPhone/{recruitPhone}")
    R<CldRecruitPlan> getInfoByRecruitPhone(@PathVariable("recruitPhone") String recruitPhone, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 保存用户openID
     *
     * @param staff 员工信息
     * @return 结果
     */
    @GetMapping("/mini/basicInfo/updateStaffOpenId")
    R<Boolean> updateStaffOpenId(@RequestBody CldStaff staff);
}
